<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%>
<%@ page import="com.bean.LoginBean"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
LoginBean LoginBean= (LoginBean)session.getAttribute("Loginbean"); 
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>我的文档管理</title>

  </head>
  <style type="text/css">
<!--
a:link {
font-size: 14px;
color: #000000;
text-decoration: none;
}
a:visited {
font-size: 14px;
color: #000000;
text-decoration: none;
}
a:hover {
font-size: 14px;
color: #999999;
text-decoration: underline;
}
-->
</style>
  <body>
   <% 
Class.forName("com.mysql.jdbc.Driver").newInstance(); 
String url="jdbc:mysql://localhost:3306/graduatedesign";  
String user="root";  
String password="root"; 
String filename="";
String username=LoginBean.getUsername();
int length1=username.length();
Connection conn = DriverManager.getConnection(url, user, password); 
Statement sm=conn.createStatement();
ResultSet rs=sm.executeQuery("select filename from upload where username='"+username+"'");
%>

<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BBD3EB">
                          <tr>
                            <td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">文件名</td>
                            <td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">下载</td>
                            <td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">删除</td>
    </tr>
<%
while(rs.next()){
%>
<tr>
                            <td height="26" align="center" bgcolor="#FFFFFF"><%=rs.getString(1).substring(length1+1,rs.getString(1).length())%></td>
                            <td height="26" align="center" bgcolor="#FFFFFF"><a href="downloadfile?filename=<%=rs.getString(1) %>">下载</td>
                            <td height="26" align="center" bgcolor="#FFFFFF"><a href="deletefile?filename=<%=rs.getString(1) %>">删除</a></td>
                          </tr>
<%}%>
<tr>
<td height="26" colspan="10" align="center" bgcolor="#FFFFFF"><font color='#1157B7'><input type="button" value="上传" onclick="window.location.href='admin/fileadd.jsp';"/></td>
          
                            
                          </tr>
</table>
  </body>
</html>
